package com.example.his.api.mis.service.impl;

import com.example.his.api.mis.service.CustomerImService;
import com.tencentyun.TLSSigAPIv2;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.HashMap;


@Service("MisCustomerImServiceImpl")
@Slf4j
public class CustomerImServiceImpl implements CustomerImService {
  @Value("${tencent.im.sdkAppId}")
  private Long sdkAppId;
  
  @Value("${tencent.im.secretKey}")
  private String secretKey;
  
  @Value("${tencent.im.managerId}")
  private String managerId;
  
  @Value("${tencent.im.customerServiceId}")
  private String customerServiceId;
  
  @Value("${tencent.im.baseUrl}")
  private String baseUrl;
  
  @Override
  public HashMap searchServiceAccount() {
    TLSSigAPIv2 api = new TLSSigAPIv2(sdkAppId, secretKey);
    //    生成客户账号签名
    String userSig = api.genUserSig(customerServiceId, 180 * 86400);
    //    保存返回的值
    HashMap result = new HashMap();
    result.put("sdkAppId", sdkAppId);
    result.put("account", customerServiceId);
    result.put("userSig", userSig);
    return result;
  }
}
